package cn.iocoder.yudao.module.cont.controller.admin.deal;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.cont.controller.admin.deal.vo.*;
import cn.iocoder.yudao.module.cont.dal.dataobject.base.BaseInfoDO;
import cn.iocoder.yudao.module.cont.service.base.BaseInfoService;
import cn.iocoder.yudao.module.cont.service.deal.DealService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 代办事项")
@RestController
@RequestMapping("/cont/deal")
@Validated
/**
 * @Author HAIYUN
 * @Date 2023/12/20 12:44
 * @Description //TODO
 */
public class DealController {
    @Resource
    private DealService dealService;


    @GetMapping("/get")
    @Operation(summary = "测试接口")
    public CommonResult<String> get() {
        return success("请求成功,okk");
    }

    @GetMapping("/getContList")
    @Operation(summary = "获取临到期合同")
    public CommonResult<List<BaseInfoDO>> getContList(){
        // 输出格式化后的日期
        return success(dealService.getDueCont());
    }

    @GetMapping("/getIndexInfo")
    @Operation(summary = "获取首页统计数目")
    public CommonResult<DealIndexRespVo> getIndexInfo(){
        return success(dealService.getIndexInfo());
    }

    @GetMapping("/getIndexCont")
    @Operation(summary = "获取首页合同到期时间统计图")
    public CommonResult<DealIndexContRespVo> getIndexCont(){
        return success(dealService.getIndexCont());
    }

    @GetMapping("/getIndexPay")
    @Operation(summary = "获取首页收付款到期时间统计图")
    public CommonResult<DealIndexPayRespVo> getIndexPay(){
        return success(dealService.getIndexPay());
    }

    @GetMapping("/getIndexContStatus")
    @Operation(summary = "获取首页合同状态统计图")
    public CommonResult<DealIndexContStatusRespVo> getIndexContStatus(){
        return success(dealService.getIndexContStatus());
    }

    @GetMapping("/getIndexContType")
    @Operation(summary = "获取首页合同类型统计")
    public CommonResult<DealIndexContTypeRespVo> getIndexContType(){
        return success(dealService.getIndexContType());
    }

}
